package model;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class UserDB extends ConnectDB{
	Statement sql;
	ResultSet rs;
	/**
	 * 登录验证用户名密码
	 * @param user
	 * @param password
	 * @return boolean
	 */
	public boolean isValidUser(String user,String password) {
		try {
			sql = con.createStatement();
			String sqlString = "SELECT * FROM root_users where r_user='"+user+"' and r_password='"+password+"'";
			rs = sql.executeQuery(sqlString);
			
			if(rs.next()) {
				con.close();
				return true;
			}else {
				con.close();
				return false;
			}
		} catch (SQLException e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
		}
		return false;
	}
}
